package org.gruposp2p.dnie.server.rest;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.MultivaluedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.context.annotation.Scope;

/**
 *
 * @author jj
 */
@Path(value = "/signatureDocumentForm")
@Component
@Scope("request")
public class FormResourceTest {

    private static Logger logger =
            LoggerFactory.getLogger(FormResourceTest.class);
    /*
     * Un buen ejemplo de recpeción de formulario con
     */
    @POST
    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
    public String postData(MultivaluedMap<String, String> formParams) {
        String result = "OK";
        String texto1 = formParams.getFirst("texto1");
        System.out.println("texto1: " + texto1);
        String texto2 = formParams.getFirst("texto2");
        System.out.println("texto2: " + texto2);
        logger.info(result);
        return result;
    }
    
}
